#ifndef __PREVIEWCANVAS_H__
#define __PREVIEWCANVAS_H__

#include <standard/delegate.h>
#include <standard/gui.h>
#include <standard/texturetarget.h>

class CPreviewCanvas : public IDelegateInterface, public CImage, public CUIEvent{
public:
    CPreviewCanvas( int32 nLeft, int32 nTop, int32 nWidth, int32 nHeight );
    virtual ~CPreviewCanvas();
    void Init();
    int32 Update( int32 nDelta, float fDelta );
    int32 Render();
    bool32 SetPreviewObjectAnimationName( const char* strAnimationName );
    void SetPreviewFile( const char* strFileName, const char* strTextureDir, const char* strPublicTextureDir );
    CDelegate2< const char*, class CGameObject* > OnPreviewedFile;

private:
    virtual void CPreviewCanvas::OnMouseEvent( CUIElement* pSelf, EUIMouseMessage eMouseMessage, int32 x, int32 y, int32 z, int32 s );

    Ref<CTextureTarget*> m_rTextureTarget;
    float m_fCanvasWidth, m_fCanvasHeight;

    Ref<class CCamera*> m_rCamera;
    Ref<class COrbitControls*> m_rCameraControls;
    Ref<class CPreviewScene*> m_rPreviewScene;
    Ref<class CGameObject*> m_rCurrentPreviewGO;
};


#endif
